Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exemplar support to histogram (and histogram part of timer) Prometheus output #2912

Merged
merged 27 commits into from
Apr 13, 2021
Merged

Conversation

tjquinno
Copy link
Member

@tjquinno tjquinno commented Apr 5, 2021

Resolves #2797.

Main changes:

  1. Consolidate some Prometheus formatting code so it can be uniformly maintained in one place and reused.
  2. Add code to metrics/metrics:
    1. Save a Sample (value, label, timestamp instead of only a value) for each observation in a histogram data set, for the most recent counter update, and for the most recent simple timer update.
    2. Change the OpenMetrics/Prometheus formatting for histograms, simple timers, and counters to emit the sample (if it's present) as a comment following the rest of the output, consistent with exemplar formatting.
    3. Add the new ExemplarServiceManager which uses the ServiceLoader mechanism to load all implementations of the new ExemplarService, if any, ordered by the @Priority annotation on the implementing classes. Helidon Metrics uses the selected implementations to get label(s) to be stored with each sample. If the ServiceLoader finds no such service, the manager uses a simple default implementation that always returns an empty string.
  3. Add a new component metrics/trace-examplar which supplies an ExemplarService implementation that supplies the current trace ID as the label.
  4. Add new SE and MP doc pages under metrics for this feature.
  5. Add a new SE example.

To trigger this behavior, users add a dependency on the new metrics/trace-examplar artifact and also add a dependency on the Helidon Zipkin or Jaeger integration.

Alternatively, a developer could provide a custom implementation of ExemplarService instead of the one in metrics/trace-exemplar.

@tjquinno tjquinno self-assigned this Apr 5, 2021
ljnelson
ljnelson previously approved these changes Apr 6, 2021
@tjquinno tjquinno changed the title Add exemplar support to histogram (and histogram part of timer) Prometheus output WIP: Add exemplar support to histogram (and histogram part of timer) Prometheus output Apr 6, 2021
@tjquinno tjquinno marked this pull request as draft April 6, 2021 17:17
@tjquinno tjquinno marked this pull request as ready for review April 6, 2021 17:17
@tjquinno tjquinno changed the title WIP: Add exemplar support to histogram (and histogram part of timer) Prometheus output Add exemplar support to histogram (and histogram part of timer) Prometheus output Apr 7, 2021
Copy link
Contributor

@ljamen ljamen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tim - I ran into a couple of 'no newline' warnings. I'm not sure if they impact anything when merging.

@tjquinno
Copy link
Member Author

tjquinno commented Apr 7, 2021

@ljamen The no-newline-at-end warnings are from GitHub, not from our build's style checker which insists on newlines at the end of only certain types of files. The clean pipeline builds we see with these files as-is indicate these are OK but I'll change those just in case given I'm fixing some things in other files.

@tjquinno tjquinno requested review from ljnelson and ljamen April 7, 2021 19:12
ljnelson
ljnelson previously approved these changes Apr 7, 2021
Copy link
Member

@ljnelson ljnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@tomas-langer tomas-langer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tjquinno tjquinno merged commit ee998f6 into helidon-io:master Apr 13, 2021
aseovic pushed a commit to aseovic/helidon that referenced this pull request Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support exemplars in Prometheus metrics output
4 participants